import { createElement, HTMLAttributes, type FC } from 'react';
import classNames from 'classnames';

import { feedEventDefaultProps } from './defaultProps';
import type { FeedEventOptions } from './type';

export interface FeedEventProps extends FeedEventOptions, HTMLAttributes<HTMLDivElement> {}

const FeedEvent: FC<FeedEventProps> = (props) => {
  const { className, children, forwardedRef, ...feedEventProps } = props;

  return createElement(
    'div',
    { ref: forwardedRef, className: classNames('event', className), ...feedEventProps },
    children,
  );
};

FeedEvent.displayName = 'FeedEvent';
FeedEvent.defaultProps = feedEventDefaultProps;

export default FeedEvent;
